home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Utilities / BareED / rexx / CountWords.rx < prev    next >
Text File  |  2000-02-05  |  645b  |  47 lines

  1. /* Demo -  to get amount of words in a file */
  2.  
  3. BAREED_HOST = GetClip('BAREED')
  4.  
  5. IF BAREED_HOST = '' THEN DO
  6.     CALL SetClip('BAREED')    /* Remove from ClipNode */
  7.     EXIT 5
  8.     END
  9.  
  10. ADDRESS VALUE BAREED_HOST
  11.  
  12. CALL SetClip('BAREED')        /* Remove from ClipNode */
  13.  
  14. OPTIONS RESULTS
  15.  
  16. /* ---------------------- MAIN --------------------- */
  17.  
  18. count = 0
  19.  
  20. move cursor archiveend
  21.  
  22. posy = 1
  23. newy = 0
  24.  
  25. do while newy < posy
  26.  
  27.     'find previous word'
  28.     fault = rc
  29.  
  30.     if fault ~= 0 then do
  31.         get cursor y
  32.         posy = result
  33.  
  34.         move cursor left
  35.  
  36.         get cursor y
  37.         newy = result
  38.  
  39.         end
  40.  
  41.     if fault = 0 then
  42.         count = count + 1
  43.  
  44. end
  45.  
  46. tell "Counted" count "word- and number strings"
  47.